# 作业：
#
# 1.随机数生成六个班的考试成绩，3门考试：Python、数学、语文。每个班50人
#
# 2.将六个班的考试成绩进行合并得到score
#
# 3.生成性别数组sex，水平叠加数组sex和score得到data
#
# 4.分别计算男女生各科成绩统计指标：最小值、最大值、平均分、中位数、标准差

import numpy as np

# 六个班的成绩 列从左到右对应Python、数学、语文
grades_1 = np.random.randint(0, 151, size=(50, 3))
grades_2 = np.random.randint(0, 151, size=(50, 3))
grades_3 = np.random.randint(0, 151, size=(50, 3))
grades_4 = np.random.randint(0, 151, size=(50, 3))
grades_5 = np.random.randint(0, 151, size=(50, 3))
grades_6 = np.random.randint(0, 151, size=(50, 3))

score = np.vstack([grades_1, grades_2, grades_3, grades_4, grades_5, grades_6])

# 0 女 1 男
sex = np.random.randint(0, 2, size=(300, 1))

data = np.hstack([score, sex])

# 男成绩
data_sex_1 = data[np.where(data[:, -1:] == 1)[0], : -1]
# 女成绩
data_sex_0 = data[np.where(data[:, -1:] == 0)[0], : -1]

print(np.min(data_sex_1, axis=0), np.min(data_sex_0, axis=0))
print(np.max(data_sex_1, axis=0), np.max(data_sex_0, axis=0))
print(np.mean(data_sex_1, axis=0), np.mean(data_sex_0, axis=0))
print(np.median(data_sex_1, axis=0), np.median(data_sex_0, axis=0))
print(np.std(data_sex_1, axis=0), np.std(data_sex_0, axis=0))

